package com.crud.generator.dto;

import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Min;
import javax.validation.constraints.Max;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * 批量数据库生成请求DTO
 * 
 * @author CRUD-Generator
 */
@Data
@Schema(description = "批量数据库生成请求")
public class BatchDatabaseRequest {
    
    @NotBlank(message = "数据库主机不能为空")
    @Schema(description = "数据库主机地址", example = "localhost")
    private String host;
    
    @NotNull(message = "数据库端口不能为空")
    @Min(value = 1, message = "端口号必须大于0")
    @Max(value = 65535, message = "端口号不能超过65535")
    @Schema(description = "数据库端口", example = "3306")
    private Integer port;
    
    @NotBlank(message = "数据库名不能为空")
    @Schema(description = "数据库名", example = "test_db")
    private String database;
    
    @NotBlank(message = "用户名不能为空")
    @Schema(description = "数据库用户名", example = "root")
    private String username;
    
    @Schema(description = "数据库密码", example = "123456")
    private String password;
    
    @NotEmpty(message = "表名列表不能为空")
    @Size(max = 10, message = "一次最多处理10个表")
    @Schema(description = "需要生成代码的表名列表")
    private List<String> tableNames;
    
    @Schema(description = "包名前缀", example = "com.example")
    private String packagePrefix;
    
    @Schema(description = "作者信息", example = "张三")
    private String author;
    
    @Schema(description = "是否生成文件（false时只返回预览）", example = "true")
    private Boolean generateFiles = true;

    @Schema(description = "是否启用Redis缓存", example = "false")
    private Boolean enableRedis = Boolean.FALSE;

    @Schema(description = "是否启用基础鉴权", example = "true")
    private Boolean enableSecurity = Boolean.FALSE;
}
